<template>
  <div class="contactUs">
    <div class="swiper_box">
      <swiper
        :options="swiperOption"
        ref="mySwiper"
        @slideChange="slideChange()"
      >
        <swiper-slide class="swiper-slide-defalut">
          <div class="homeBanner" v-if="showClass != 'aaa'">
            <FootBarHeader
              @getTopClass="getTopClass"
              class="footBarHeader"
            ></FootBarHeader>
            <div class="hetitlecc">
              <div class="big animated fadeInUp">轰隆隆-优秀建企首选机械租赁平台</div>
               <div class="top animated fadeInUp">Machinery Leasing Platform</div>
              <div class="line"></div>
            </div>
            <div id="bannerBox">
              <div id="bannerImg"></div>
              <div id="overlay"></div>
            </div>
            <div @click="nowNext">
              <lottie
                :height="49"
                :width="49"
                class="iconImg"
                :options="defaultOptions"
                @animCreated="handleAnimation"
              />
            </div>
          </div>
          <div class="homeBannerDark" v-else>
            <FootBarHeader
              @getTopClass="getTopClass"
              class="footBarHeader"
            ></FootBarHeader>
            <div class="tabTextcons">
              <div class="tabTextcon" @click="goNewpage(1)">
                <div class="tabText">
                  <span>企业介绍</span>
                  <span class="tabTexte">company profile</span>
                </div>
                <img
                  src="../../../assets/img/footIcon/raIcon.png"
                  class="raLcon"
                  alt=""
                />
              </div>
              <div class="tabTextcon" @click="goNewpage(2)">
                <div class="tabText">
                  <span>发展历史</span>
                  <span class="tabTexte">development history</span>
                </div>
                <img
                  src="../../../assets/img/footIcon/raIcon.png"
                  class="raLcon"
                  alt=""
                />
              </div>
              <div class="tabTextcon" @click="goNewpage(3)">
                <div class="tabText">
                  <span>联系我们</span>
                  <span class="tabTexte">contact us</span>
                </div>
                <img
                  src="../../../assets/img/footIcon/raIcon.png"
                  class="raLcon"
                  alt=""
                />
              </div>
            </div>
          </div>
        </swiper-slide>
        <swiper-slide class="swiper-slide-defalut" id="ahome">
          <div class="cuhomeBanner2">
            <div class="conAddress">
              <img
                class="conMap"
                src="https://file.honglonglong.com.cn/hll_newPc/aboutUs/contactUs/addressMap.png"
                alt=""
              />
              <div class="leftlable">
                <img
                  class="logo"
                  src="https://file.honglonglong.com.cn/hll_newPc/aboutUs/contactUs/logo.png"
                  alt=""
                />
                <div class="labletext">
                  <div class="title">北京轰隆隆科技有限公司</div>
                  <div class="text">
                    北京市朝阳区慈云寺北里210号远洋国际中心E座15层
                  </div>
                </div>
              </div>

              <img
                class="left2"
                src="https://file.honglonglong.com.cn/hll_newPc/aboutUs/contactUs/arrow4455.png"
                alt=""
              />
              <div class="right">
                <div>邮政编码</div>
                <div class="two">100102</div>
                <div class="line"></div>
                <div>公交路线</div>
                <div class="two">115、595、635、648、690</div>
                <div class="line"></div>
                <div>地铁路线</div>
                <div class="two">1号线、八通线</div>
                <div class="line"></div>
                <div>邮箱</div>
                <div class="two">service@honglonglong.net</div>
              </div>
            </div>
            <div class="btm">
              <div class="model">
                <div class="top">全国免费服务热线</div>
                <div>4008-188-191</div>
              </div>
              <div class="model">
                <div class="top">总机</div>
                <div>010-64770870</div>
              </div>
              <div class="model">
                <div class="top">商务合作—高先生</div>
                <div>business@honglonglong.net</div>
              </div>
              <div class="model1">
                <div class="left">
                  <div>扫码添加微信</div>
                  <div>邀请进群</div>
                </div>
                <div class="wx">
                  <img
                    class="icon"
                    src="../../../assets/img/navbar/weixinicon.png"
                    alt=""
                  />
                  <img
                    class="post"
                    src="../../../assets/img/navbar/qrwx.png"
                    alt=""
                  />
                </div>
              </div>
            </div>
          </div>
        </swiper-slide>
      </swiper>
      <FooterBar class="footerBar" v-if="show"></FooterBar>
    </div>
  </div>
</template>

<script>
const animationData = require("@/assets/js/data.json");
import FootBarHeader from "../../../components/FootBarHeader";
import HomeBanner from "../home/Homebanner";
import HomeMechanics from "../home/HomeMechanics";
import FooterBar from "../../../components/FooterBar";
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
import "swiper/css/swiper.css";
export default {
  name: "contactUs",
  data() {
    return {
      swiperOption: {
        // pagination:'.swiper-pagination',
        notNextTick: true, // notNextTick是一个组件自有属性，如果notNextTick设置为true，组件则不会通过NextTick来实例化swiper，也就意味着你可以在第一时间获取到swiper对象，假如你需要刚加载遍使用获取swiper对象来做什么事，那么这个属性一定要是true
        direction: "vertical", // 水平方向移动
        grabCursor: true, // 鼠标覆盖Swiper时指针会变成手掌形状，拖动时指针会变成抓手形状
        setWrapperSize: true, // Swiper使用flexbox布局(display: flex)，开启这个设定会在Wrapper上添加等于slides相加的宽或高，在对flexbox布局的支持不是很好的浏览器中可能需要用到。
        autoHeight: true, // 自动高度。设置为true时，wrapper和container会随着当前slide的高度而发生变化
        observer: true, // 修改swiper自己或子元素时，自动初始化swiper
        observeParents: true, // 修改swiper的父元素时，自动初始化swiper
        slidesPerView: 1, // 设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为数字（可为小数，小数不可loop），或者 'auto'则自动根据slides的宽度来设定数量。loop模式下如果设置为'auto'还需要设置另外一个参数loopedSlides。
        observer: true,
        initialSlide: 0,
        mousewheel: false, // 开启鼠标滚轮控制Swiper切换。可设置鼠标选项，默认值false
        height: window.innerHeight, // 高度设置，占满设备高度
        // autoHeight: true, // 高度随内容变化
        resistanceRatio: 0, // 抵抗率。边缘抵抗力的大小比例。值越小抵抗越大越难将slide拖离边缘，0时完全无法拖离。本业务需要
        observeParents: true, // 将observe应用于Swiper的父元素。当Swiper的父元素变化时，例如window.resize，Swiper更新
        // autoplayDisableOnInteraction: false, //鼠标划过之后继续轮播
        speed: 1000, // 滚动速度
      },
      defaultOptions: { animationData: animationData, loop: true },
      defalut_top: 0,
      show: false,
      isFresh: false,
      showClass: false,
    };
  },
  watch: {},
  components: {
    FootBarHeader,
    HomeBanner,
    HomeMechanics,
    Swiper,
    SwiperSlide,
    FooterBar,
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    },
    //  $route() {
    //   console.log(this.$route);
    // },
  },

  mounted() {
    this.scrollFunction();
    console.log("Current Swiper instance object", this.swiper);
    window.addEventListener("scroll", this.handleScroll, true);
    this.$refs.mySwiper.$swiper.mousewheel.enable();
    this.$refs.mySwiper.$swiper.slideTo(1, 0, false);
  },
  methods: {
    goNewpage(data) {
      if (data === 1) {
        this.$router.push({ path: "p_cpf" });
      } else if (data === 2) {
        this.$router.push({ path: "p_cpf" ,query:{mid:6}});
      } else if (data === 3) {
        this.$router.go(0)
        // this.$router.push({ path: "p_ctu" });
      }
    },
    handleAnimation: function (animate) {
      this.animObj = animate;
      console.log(animate); //这里可以看到 lottie 对象的全部属性
    },
    nowNext() {
      this.$refs.mySwiper.$swiper.slideNext();
    },
    getTopClass(data) {
      this.showClass = data;
      console.log(data);
    },
    scrollFunction() {
      this.domObj = document.getElementById("ahome"); // 通过id获取要设置的div
      if (this.domObj.attachEvent) {
        // IE
        this.domObj.attachEvent("onmousewheel", this.mouseScroll);
      } else if (this.domObj.addEventListener) {
        this.domObj.addEventListener("DOMMouseScroll", this.mouseScroll, false);
      }
      this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll;
    },
    mouseScroll(event) {
      // google 浏览器下
      let detail = event.wheelDelta || event.detail; // 判读滚动方向
      // console.log(detail);
      // console.log( this.i)  // 是否离开底部
      if (detail > 0 && !this.i) {
        this.$router.afterEach((to, from, next) => {
          window.scrollTo(0, 0);
        });
        this.$refs.mySwiper.$swiper.mousewheel.enable();
      }
    },
    slideChange(e) {
      const activeIndex = this.$refs.mySwiper.$swiper.activeIndex;
      if (activeIndex === 1) {
        this.show = true;
        setTimeout(() => {
          this.$refs.mySwiper.$swiper.mousewheel.disable();
        }, 500);
      } else {
        this.show = false;
      }
    },

    handleScroll() {
      // 页面滚动距顶部距离
      var scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      var scroll = scrollTop - this.i;
      this.i = scrollTop;
      if (scroll < 0) {
        if (scrollTop < 10) {
          this.$refs.mySwiper.$swiper.mousewheel.enable();
        }
      } else {
        console.log("down");
      }
    },
  },
};
</script>
<style lang="scss" scoped>
@-moz-keyframes bannerBox {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@-webkit-keyframes bannerBox {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@-ms-keyframes bannerBox {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes bannerBox {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}
#bannerBox {
  -moz-animation: bannerBox 3s forwards;
  -webkit-animation: bannerBox 3s forwards;
  -ms-animation: bannerBox 3s forwards;
  animation: bannerBox 3s forwards;
  height: 100%;
  left: 0;
  opacity: 0;
  position: fixed;
  top: 0;
  width: 100%;
  object-fit: cover;
}
#bannerImg {
  // -moz-animation: bannerImg 60s linear infinite;
  // -webkit-animation: bannerImg 60s linear infinite;
  // -ms-animation: bannerImg 60s linear infinite;
  // animation: bannerImg 60s linear infinite;
  // -moz-backface-visibility: hidden;
  // -webkit-backface-visibility: hidden;
  // -ms-backface-visibility: hidden;
  // backface-visibility: hidden;
  // -moz-transform: translate3d(0, 0, 0);
  // -webkit-transform: translate3d(0, 0, 0);
  // -ms-transform: translate3d(0, 0, 0);
  // transform: translate3d(0, 0, 0);
  /* Set your background with this */

  background: url("https://file.honglonglong.com.cn/hll_newPc/aboutUs/contactUs/1400px810.png")
    no-repeat;
  background-size: 100%, 100%;
  background-repeat: repeat-x;
  height: 100%;
  left: 0;
  opacity: 1;
  position: fixed;
  top: 0;
  object-fit: cover;
}
@-moz-keyframes bannerImg {
  0% {
    -moz-transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  100% {
    -moz-transform: translate3d(-2250px, 0, 0);
    -webkit-transform: translate3d(-2250px, 0, 0);
    -ms-transform: translate3d(-2250px, 0, 0);
    transform: translate3d(-2250px, 0, 0);
  }
}

@-webkit-keyframes bannerImg {
  0% {
    -moz-transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  100% {
    -moz-transform: translate3d(-2250px, 0, 0);
    -webkit-transform: translate3d(-2250px, 0, 0);
    -ms-transform: translate3d(-2250px, 0, 0);
    transform: translate3d(-2250px, 0, 0);
  }
}

@-ms-keyframes bannerImg {
  0% {
    -moz-transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  100% {
    -moz-transform: translate3d(-2250px, 0, 0);
    -webkit-transform: translate3d(-2250px, 0, 0);
    -ms-transform: translate3d(-2250px, 0, 0);
    transform: translate3d(-2250px, 0, 0);
  }
}

@keyframes bannerImg {
  0% {
    -moz-transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  100% {
    -moz-transform: translate3d(-2250px, 0, 0);
    -webkit-transform: translate3d(-2250px, 0, 0);
    -ms-transform: translate3d(-2250px, 0, 0);
    transform: translate3d(-2250px, 0, 0);
  }
}
#bannerImg {
  background-size: 2250px auto;
  width: 6750px;
}
@-moz-keyframes overlay {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 0.4;
  }
}

@-webkit-keyframes overlay {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 0.4;
  }
}

@-ms-keyframes overlay {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 0.4;
  }
}

@keyframes overlay {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 0.4;
  }
}

#overlay {
  -moz-animation: overlay 1.5s 1.5s forwards;
  -webkit-animation: overlay 1.5s 1.5s forwards;
  -ms-animation: overlay 1.5s 1.5s forwards;
  animation: overlay 1.5s 1.5s forwards;
  background-attachment: fixed, fixed;
  background-image: url("https://hll-prod.oss-cn-beijing.aliyuncs.com/hll_newPc/engineering/download.png"),
    url("https://hll-prod.oss-cn-beijing.aliyuncs.com/hll_newPc/engineering/download.svg");
  background-position: top left, center center;
  background-repeat: repeat, no-repeat;
  background-size: auto, cover;
  height: 100%;
  left: 0;
  opacity: 0;
  position: fixed;
  top: 0;
  width: 100%;
}
.swiper_box {
  position: relative;
}
.swiper-slide-defalut {
  // height: 100vh;
  // overflow: hidden;
}
.contactUs {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
  background: rgba(255, 255, 255, 0.3);
}
.homeBanner {
  position: relative;
  width: 100vw;
  height: 100vh;
  .banerimg {
    object-fit: cover;
    height: 100%;
    width: 100%;
  }
  .iconImg {
    position: absolute;
    bottom: 1%;
    left: 50%;
    transform: translate(-50%, 0);
    width: 49px;
    height: 49px;
    z-index: 10;
  }
  .hetitlecc {
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 848px;
    height: 263px;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: url(https://file.honglonglong.com.cn/hll_newPc/footerBar/banner1border.png)
      no-repeat;
    background-size: 100% 100%;
    color: #ffffff;
    .top {
      font-size: 20px;
      font-weight: 500;
      margin-top: 20px;
    }
    .big {
      font-size: 50px;
      font-weight: bold;
      margin-top: 20px;
    }
    .line {
      width: 200px;
      height: 1px;
      background: #ffffff;
      margin: 41px 0;
    }
    .text {
      font-size: 20px;
      font-weight: 500;
      .key {
        color: #ff855b;
      }
    }
  }
}
.homeBannerDark {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  background: #202734;
  .tabTextcons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    .tabTextcon {
      cursor: pointer;
      width: 360px;
      font-size: 24px;
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: space-between;
      // flex-direction: column;
      margin-top: 70px;
      .tabText {
        display: flex;
        flex-direction: column;
        .tabTexte {
          font-size: 14px;
          color: #909399;
          margin-top: 8px;
        }
      }
      .raLcon {
        width: 37px;
        height: 11px;
        // margin-left: 144px ;
      }
    }
    .tabTextcon:hover {
      cursor: pointer;
    }
  }
}
.footBarHeader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.cuhomeBanner2 {
  width: 99vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  .conAddress {
    margin: 20rpx 130px;
    position: relative;
    // display: flex;
    width: 1180px;
    height: 550px;
    .conMap {
      width: 1180px;
      height: 550px;
    }
    .leftlable {
      width: 409px;
      height: 120px;
      position: absolute;
      top:100px;
      left: 362px;
      background: url(https://file.honglonglong.com.cn/hll_newPc/aboutUs/contactUs/juxing409102.png)
        no-repeat;
      background-size: 100% 100%;
      display: flex;
      // margin: 0 20px;
      .logo {
        width: 60px;
        height: 60px;
        margin: 16px 0 0 20px;
      }
      .labletext {
        font-size: 12px;
        font-weight: 400;
        color: #ffffff;
        margin-left: 16px;
        margin: 16px 20px 0 16px;
        .title {
          font-size: 16px;
          font-weight: 500;
          margin-bottom: 5px;
        }
        .text {
          font-size: 12px;
          font-weight: 400;
          color: #ffffff;
        }
      }
    }

    .left2 {
      width: 44px;
      height: 55px;
      position: absolute;
      top: 219px;
      left: 545px;
    }
    .right {
      position: absolute;
      top: 50%;
      right: 40px;
      transform: translate(0, -50%);
      width: 260px;
      height: 481px;
      padding: 20px;
      background: #ffffff;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .two {
        margin-top: 10px;
      }
      .line {
        width: 28px;
        height: 3px;
        background: #ff855b;
        margin: 30px 0;
      }
    }
  }
  .btm {
    width: 1180px;
    margin: 20 130px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 30px;
    .model {
      margin-top: 1%;
      width: 234px;
      border-top: 1px solid #cccccc;
      font-size: 14px;
      font-weight: 400;
      color: #303133;
      padding-top: 30px;
      .top {
        margin-top: 3%;
      }
      .left {
        margin-top: 3%;
      }
      .right {
        margin-top: 3%;
      }
    }
    .model > div:nth-child(2) {
      margin-top: 10px;
    }
    .model1 {
      margin-top: 1%;
      min-width: 234px;
      border-top: 1px solid #cccccc;
      font-size: 14px;
      font-weight: 400;
      color: #303133;
      padding-top: 30px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        margin-top: 3%;
      }
      .left > div:nth-child(2) {
        margin-top: 10px;
      }
      .wx {
        cursor: pointer;
        position: relative;
        width: 40px;
        height: 33px;
        margin-top: 3%;
        .icon {
          width: 40px;
          height: 33px;
        }
        .post {
          display: none;
        }
      }
      .wx:hover {
        .post {
          width: 120px;
          height: 120px;
          display: block;
          position: absolute;
          right: -130px;
          top: -40px;
        }
      }
    }
  }
}
</style>
